package mac.runtimeChecker.medlParser;

import mac.types.parserTypes.*;

public class ASTEvent extends SimpleNode {
  static final int START = 0;
  static final int END = 1;
  static final int UPDATE = 2;
  static final int STARTM = 3;
  static final int ENDM = 4;
  static final int IOM = 5;
  static final int AND = 6;
  static final int OR = 7;
  static final int WHEN = 8;
  static final int PARENTHESIS = 9;
  static final int IDENTIFIER = 10;
  static final int ASSIGNMENT = 11;	

  protected int op;
  protected String name;
  protected long time;
  protected Object value;
  protected Object eventValue;


  ASTEvent(int id) {
    super(id);
  }

  public int getOp() {
    return op;
  }
  public String getName() {
    return name;
  }
  public Object getValue() {
    return value;
  }
  public long getTime() {
    return time;
  }
  public Object getEventValue() { return eventValue;}

  public void setOp(int o) {
    op = o;
  }
  public void setName(String n) {
    name = n;
  }
  public void setValue(Object v) {
    value = v;
  }
  public void setTime(long t) {
    time = t;
  }

  public String toString() {
    String s= null;
    String s2= null;
    Object realValue = null;
    SymtabEntry se = null;

    switch (op) {
      case START: s ="Event: start of condition"; break;
      case END: s ="Event: end of condition"; break;
      case UPDATE: s ="Event: update"; break;
      case STARTM: s ="Event: start of method"; break;
      case ENDM: s ="Event: end of method"; break;
      case IOM: s ="Event: input-output of method"; break;
      case AND: s ="Event: and"; break;
      case OR: s ="Event: or"; break;
      case WHEN: s ="Event: when"; break;
      case PARENTHESIS: s ="Event: parenthesis"; break;
      case IDENTIFIER: s ="Event: identifier"; break;
      case ASSIGNMENT: s ="Event: assignment"; break;
      default: s ="Event: error"; break;
    }
    return s;

/*      if(value instanceof SymtabEntry) {
	  se = (SymtabEntry)value;
	  if( ((String)(se.getType())).equals("_macType")) {
	      realValue = ((Node)(se.getValue())).getValue(); 
	  } else {
	      realValue = se.getValue();
	  }
      } else {
	  realValue = value;
      }

      return s + "(name:"+ name + ",value:" 
	    + realValue + ",mark:" + mark +")" ; */
  }
}
